package me.leiusual.sharing.ui.cart

import androidx.lifecycle.ViewModel
import dagger.Binds
import dagger.Module
import dagger.android.ContributesAndroidInjector
import dagger.multibindings.IntoMap
import me.leiusual.sharing.di.FragmentScope
import me.leiusual.sharing.di.ViewModelKey

/**
 * Create by leiusual on 2018/8/14
 */
@Module
abstract class CartModule {

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun cartHomeFragment(): CartHomeFragment

  @Binds
  @IntoMap
  @ViewModelKey(CartHomeViewModel::class)
  abstract fun cartHomeViewModel(cartHomeViewModel: CartHomeViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun cartOrderFragment(): CartOrderFragment

  @Binds
  @IntoMap
  @ViewModelKey(CartOrderViewModel::class)
  abstract fun cartOrderViewModel(cartOrderViewModel: CartOrderViewModel): ViewModel
}